package com.tanhua.server.controller;

import com.tanhua.model.vo.VoiceVo;
import com.tanhua.server.service.ReachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class ReachblossomController {

    @Autowired
    private ReachblossomService reachblossomService;

    /**
     * 发送语音
     */
    @PostMapping
    public ResponseEntity<Void> sendVoices(MultipartFile soundFile) throws IOException {
        reachblossomService.sendVoices(soundFile);
        return ResponseEntity.ok(null);
    }

    /**
     * 接受语音
     */
    @GetMapping
    public ResponseEntity<VoiceVo> acceptVoice() {
        VoiceVo voice = reachblossomService.acceptVoice();
        return ResponseEntity.ok(voice);
    }


}
